<template>
  <div class="row page work-page">
    <div class="col part" v-for="(items, key) in works" :key="key">
      <div class="type">{{items.title}}</div>
      <div class="row items">
        <div class="row item" v-for="(item, index) in items.items" :key="index">
          <img :src="item.cover" class="cover"/>
          <div class="col detail">
            <div class="title">{{item.title}}</div>
            <div class="time">上映时间：{{item.time}}</div>
            <div class="role">饰演：{{item.role}}</div>
            <div class="intro">简介：{{item.intro}}</div>
            <div class="operate">
              <button @click="linkToPage(item.link)">追剧</button>
              <button @click="more(index)">剧照</button>
            </div>
          </div>
        </div> 
      </div>   
    </div>
  </div>
</template>

<script>
import works from '../data/works'
export default {
  name: 'works',
  data() {
    return {
      works: works
    }
  },
  methods: {
    linkToPage(url) {
      window.open(url)
    },
    more(i) {
      this.$router.push({ path: '/photoList/' + 99, query: {production: i}})
    },
  }
}
</script>

<style>
  .work-page {
    flex-wrap: wrap;
  }
  .work-page .cover {
    margin-right: 22px;
    width: 180px;
  }
  .work-page .items {
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
    justify-content: space-between;
  }
  .work-page .item {
    width: 48%;
    box-sizing: border-box;
    align-items: flex-start;
    margin-bottom: 22px;
    padding-bottom: 22px;
    /* border-bottom: 2px solid #353535; */
  }
  .work-page .title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
  }
  .work-page .time, .work-page .role {
    font-size: 14px;
  }
  .work-page .intro {
    margin-top: 12px;
    font-size: 14px;
    line-height: 16px;
    margin-bottom: 5px;
  }
  .operate {
    margin-top: 12px;
  }
  .operate button {
    margin-right: 22px;
    width: 100px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: #ba4557;
    color: #fff;
    border: none;
    letter-spacing: 2px;
    cursor: pointer;
  }
  .work-page .detail {
    align-items: flex-start;
  }
  .part {
    margin-bottom: 12px;
    width: 100%;
  }
  .part:last-child {
    margin-bottom: 0;
  }
  .type {
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    padding: 10px 0;
    /* border-top: 1px solid #353535; */
    border-bottom: 1px solid #353535;
    font-weight: bold;
    margin-bottom: 16px;
  }
  @media screen and (max-width: 768px){
    .work-page {
      flex-direction: column;
    }
    .work-page .item {
      box-sizing: border-box;
      width: 100%;
      padding: 0px 12px 12px 12px;
      justify-content: flex-start;
    }
    .work-page .item img {
      width: 44%;
      height: auto;
      margin-right: 12px;
    }
    .work-page .item .detail {
      box-sizing: border-box;
      height: 100%;
      align-items: flex-start;
    }
    .work-page .operate {
      align-content: flex-end;
    }
    .work-page .operate button {
      width: 60px;
      height: 26px;
      border: none;
      box-shadow: none;
      outline: none;
      line-height: 26px;
    }
    .work-page .operate button::after {
      border: none;
    }
    .type {
      width: 100%;
      text-align: center;
      box-sizing: border-box;
      padding: 10px 0;
      border-top: 1px solid #353535;
      border-bottom: 1px solid #353535;
      font-weight: bold;
      margin-bottom: 16px;
    }
  }
</style>